% clear all; close all;
% load patch
% 
% mode = 1; % 1 stands for patch, 2 stands for random
%  
% pixel = 64;
% method = 5;
% r = 2;
% d = 1;
% k = 4;
% 
% % generate low rank patch group
% if mode == 1
%     cln = repmat(patch,1,method);
% else
%     RU = randn(pixel,r)+10;
%     RV = randn(r,method)+20;
%     cln = RU * RV;    
% end
% Mu = zeros(d,k);
% Sigma = zeros(d,d,k);
% 
% % for num = 1:k
% %     Sigma(:,:,num) = rand(1);
% % end
% Sigma = cat(3,0.9,0.02,0.1,4);
% totalnum = pixel*method;
% temp = rand(1,k);
% datanum = round(totalnum*temp/sum(temp));
% if sum(datanum) ~= pixel*method
%     datanum(end) = datanum(end) + 1;
% end
% data = [];
% for i = 1:k
%     mu = Mu(:,i);
%     sigma = Sigma(:,:,i);
%     temp = mvnrnd(mu',sigma,datanum(i));
%     data = [data,temp'];
% end
% randomorder = randperm(totalnum);
% data = data(:,randomorder);
% 
% model.mu = Mu;
% model.Sigma = Sigma;
% 
% Plot_data(data); 
% nos = cln + reshape(data,pixel,method);
% 
% save Data cln nos datanum Sigma


load case1.mat;
N = zeros(64,4,size(Blocks_O,2));
C = zeros(64,4,size(Blocks_O,2));
for index = 1:size(Blocks_O,2)
    N(:,:,index) = [Blocks_Eb(:,index),Blocks_Ew(:,index),Blocks_Ee(:,index),...
    Blocks_Ec(:,index)];
    C(:,:,index) = repmat(Blocks_O(:,index),1,4);
% nos = [img_BM3D(:),img_WNNM(:),img_EPLL(:),img_CSRD(:),nosImg(:)];
% cln = repmat(clnImg(:),1,method_num+1);
end
save Real N C 
